package com.bjc.base.bean.response;

import java.time.LocalDateTime;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 绘本归还日志
 * </p>
 *
 * @author 许自辉
 * @since 2018-06-10
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class BorrowReturnLogVO extends BasesVO {

	/**
	 * 相关用户ID
	 */
	private Integer uid;
	/**
	 * 条数
	 */
	private Integer count;
	/**
	 * 微信标识
	 */
	private String openid;
	/**
	 * 日志类型(1借阅、2归还)
	 */
	private Integer state;
	/**
	 * 绘本ID
	 */
	private Integer pid;
	/**
	 * 绘本ID
	 */
	private Integer bid;
	/**
	 * 借阅周数
	 */
	private Integer borrowWeeks;
	/**
	 * 借阅时间
	 */
	private LocalDateTime borrowStartTime;
	/**
	 * 借阅到期时间
	 */
	private LocalDateTime borrowEndTime;
	/**
	 * 归还时间
	 */
	private LocalDateTime returnTime;
	/**
	 * 归还借阅点
	 */
	private Integer returnPid;
	/**
	 * 归还点名称
	 */
	private String returnPName;
	/**
	 * 借阅点名称
	 */
	private String borrowPName;

	/**
	 * 绘本库存
	 */
	private BookStockVO bookStock;
	private BookVO book;
	private UserVO user;
	
	public LocalDateTime getBorrowEndTime() {
		if (borrowWeeks != null && borrowStartTime != null) {
			this.borrowEndTime = borrowStartTime.plusWeeks(borrowWeeks);
		}
		return this.borrowEndTime;
	}

}
